package com.zhq.blog.core.domain;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.LinkedList;
import java.util.List;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

import com.zhq.blog.core.domain.admin.AdminControllerCategory;
import com.zhq.blog.core.domain.admin.AdminControllerDescription;
import com.zhq.blog.core.domain.admin.Operator;
import com.zhq.blog.core.domain.game.Game;
import com.zhq.blog.core.domain.game.support.Odds;
import com.zhq.blog.core.domain.money.BusinessMan;
import com.zhq.blog.core.domain.money.Card;
import com.zhq.blog.core.domain.money.CardRecord;
import com.zhq.blog.core.domain.money.CreateCard;
import com.zhq.blog.core.domain.product.Category;
import com.zhq.blog.core.domain.product.Note;
import com.zhq.blog.core.domain.product.Prize;
import com.zhq.blog.core.domain.product.PrizeExplain;
import com.zhq.blog.core.domain.system.Help;
import com.zhq.blog.core.domain.system.HoldId;
import com.zhq.blog.core.domain.system.Information;
import com.zhq.blog.core.domain.system.Notice;
import com.zhq.blog.core.domain.user.Sale;
import com.zhq.blog.core.domain.user.User;
import com.zhq.blog.core.domain.user.UserRank;

public class Seed {
	
	protected Log logger = LogFactory.getLog(this.getClass());
	
	Context context;
	public Seed(Context context){
		this.context = context;
	}
	
	public void init() {
		createAdminControllers();
        createOperator();
        initGame();
        createUsers();
        createUserRanks();
        createSale();
        createCategory();
        initOdds();
        createPrize();
        createNote();
        createBusinessMan();
        createCard();
        createCreateCard();
        createCardRecord();
        createPrizeExplain();
        createInformation();
        createHelp();
        createNotice();
        createHoldId();
	}
	private void initOdds(){
		List<Odds> odds = new LinkedList<Odds>();
		//幸运28赔率设置
		odds.add(new Odds(0, 1000,1,1000,0));odds.add(new Odds(1, 333.33,1,333,0));
		odds.add(new Odds(2, 166.67,1,167,1));
		odds.add(new Odds(3, 100,1,100,1));odds.add(new Odds(4, 66.66,1,67,2));odds.add(new Odds(5, 47.61,1,48,2));
		odds.add(new Odds(6, 35.71,1,36,3));odds.add(new Odds(7, 27.77,1,28,4));odds.add(new Odds(8, 22.22,1,22,5));
		odds.add(new Odds(9, 18.18,1,18,6));odds.add(new Odds(10, 15.87,1,16,6));
		odds.add(new Odds(11, 14.49,1,14,7));
		odds.add(new Odds(12, 13.69,1,14,7));odds.add(new Odds(13, 13.33,1,13,8));
		odds.add(new Odds(14, 13.33,1,13,8));
		odds.add(new Odds(15, 13.69,1,14,7));odds.add(new Odds(16, 14.49,1,14,7));
		odds.add(new Odds(17, 15.87,1,16,6));
		odds.add(new Odds(18, 18.18,1,18,6));odds.add(new Odds(19, 22.22,1,22,5));
		odds.add(new Odds(20, 27.27,1,28,4));
		odds.add(new Odds(21, 35.71,1,36,3));odds.add(new Odds(22, 47.61,1,48,2));
		odds.add(new Odds(23, 66.66,1,67,2));
		odds.add(new Odds(24, 100,1,100,1));odds.add(new Odds(25, 166.67,1,167,1));
		odds.add(new Odds(26, 333.33,1,333,0));
		odds.add(new Odds(27, 1000,1,1000,0));
		
		//欢乐11赔率设置
		odds.add(new Odds(2, 36,2,36,3));odds.add(new Odds(3, 18,2,18,6));
		odds.add(new Odds(4, 12,2,12,8));
		odds.add(new Odds(5, 9,2,9,11));odds.add(new Odds(6, 7.2,2,7,14));odds.add(new Odds(7, 6,2,6,17));
		odds.add(new Odds(8, 7.2,2,7,14));odds.add(new Odds(9, 9,2,9,11));
		odds.add(new Odds(10, 12,2,12,8));
		odds.add(new Odds(11, 18,2,18,6));odds.add(new Odds(12, 36,2,36,3));
		
		//欢乐16赔率设置
		
		odds.add(new Odds(3, 216,3,216,0));odds.add(new Odds(4, 72,3,72,1));odds.add(new Odds(5, 36,3,36,3));
		odds.add(new Odds(6, 21.6,3,22,5));odds.add(new Odds(7, 14.4,3,14,7));odds.add(new Odds(8, 10.29,3,10,10));
		odds.add(new Odds(9, 8.64,3,9,12));odds.add(new Odds(10, 8,3,8,12));
		odds.add(new Odds(11, 8,3,8,12));
		odds.add(new Odds(12, 8.64,3,9,12));odds.add(new Odds(13, 10.29,3,10,10));
		odds.add(new Odds(14, 14.4,3,14,7));
		odds.add(new Odds(15, 21.6,3,22,5));odds.add(new Odds(16, 36,3,36,3));
		odds.add(new Odds(17, 72,3,72,1));
		odds.add(new Odds(18, 216,3,216,0));
		
		
		//欢乐10赔率设置
		for(int i=1;i<11;i++){
			odds.add(new Odds(i,10,4,10,10));
		}
		
		for(Odds odd:odds){
			context.getOddsRepository().save(odd);
		}
		
	}
	private void initGame(){
		List<Game> games = new ArrayList<Game>();
		games.add(
				new Game(
						180, Long.valueOf("3000000000"), "幸运28", "0,1,2,3,4,5,6,7,8,9",3,
						"0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27"));
		games.add(new Game(28, Long.valueOf("3000000000"), "欢乐11", "1,2,3,4,5,6",2, "2,3,4,5,6,7,8,9,10,11,12"));
		games.add(new Game(90, Long.valueOf("3000000000"), "欢乐16", "1,2,3,4,5,6",3, "3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18"));
		games.add(new Game(28, Long.valueOf("3000000000"), "欢乐10", "1,2,3,4,5,6,7,8,9,10",1,"1,2,3,4,5,6,7,8,9,10"));
		
		for(Game g :games){
			context.getGameRepository().save(g);
		}
	}
	
	private void createUsers(){
		SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
		List<User> users = new ArrayList<User>();
		try{
			//特殊用户  用于系统给玩家发送站内信  请勿删除或者改动
			users.add(new User(10000, "10001@163.com", "123456", sdf.parse("2014-06-01 10:00:00"), "192.178.1.2", 999999999999999L, 2555, 0, 2555, 2555, "//", false));
			
			
			users.add(new User(10001, "10001@163.com", "123456", sdf.parse("2014-06-01 10:00:00"), "192.178.1.2", Integer.MAX_VALUE, 2555, 0, 2555, 2555, "//", false));
			users.add(new User(10002, "10001@163.com", "123456", sdf.parse("2014-06-01 10:00:00"), "192.178.1.2", Integer.MAX_VALUE, 2555, 0, 2555, 2555, "//", false));
			users.add(new User(10003, "10001@163.com", "123456", sdf.parse("2014-06-01 10:00:00"), "192.178.1.2", Integer.MAX_VALUE, 2555, 0, 2555, 2555, "//", false));
			users.add(new User(10004, "10001@163.com", "123456", sdf.parse("2014-06-01 10:00:00"), "192.178.1.2", Integer.MAX_VALUE, 2555, 0, 2555, 2555, "//", false));
			users.add(new User(10005, "10001@163.com", "123456", sdf.parse("2014-06-01 10:00:00"), "192.178.1.2", Integer.MAX_VALUE, 2555, 0, 2555, 2555, "//", false));
			users.add(new User(10006, "10001@163.com", "123456", sdf.parse("2014-06-01 10:00:00"), "192.178.1.2", Integer.MAX_VALUE, 2555, 0, 2555, 2555, "//", false));
			users.add(new User(10007, "10001@163.com", "123456", sdf.parse("2014-06-01 10:00:00"), "192.178.1.2", Integer.MAX_VALUE, 2555, 0, 2555, 2555, "//", false));
			users.add(new User(10008, "10001@163.com", "123456", sdf.parse("2014-06-01 10:00:00"), "192.178.1.2", Integer.MAX_VALUE, 2555, 0, 2555, 2555, "//", false));
			users.add(new User(10009, "10001@163.com", "123456", sdf.parse("2014-06-01 10:00:00"), "192.178.1.2", Integer.MAX_VALUE, 2555, 0, 2555, 2555, "//", false));
			users.add(new User(100010, "10001@163.com", "123456", sdf.parse("2014-06-01 10:00:00"), "192.178.1.2", Integer.MAX_VALUE, 2555, 0, 2555, 2555, "//", false));
			users.add(new User(100011, "10001@163.com", "123456", sdf.parse("2014-06-01 10:00:00"), "192.178.1.2", Integer.MAX_VALUE, 2555, 0, 2555, 2555, "//", false));
			users.add(new User(100012, "10001@163.com", "123456", sdf.parse("2014-06-01 10:00:00"), "192.178.1.2", Integer.MAX_VALUE, 2555, 0, 2555, 2555, "//", false));
			
		}catch(ParseException e){
			e.printStackTrace();
		}
		for(User user:users){
			context.getUserRepository().save(user);
		}
		
	}
	
	private void createUserRanks(){
		List<UserRank> userRanks = new ArrayList<UserRank>();
		
		userRanks.add(new UserRank("VIP1", 10,20,0, 1, 1,1,1 ));
		userRanks.add(new UserRank("VIP2", 10,20,0, 1, 1,1,1 ));
		userRanks.add(new UserRank("VIP3", 10,20,0, 1, 1,1,1 ));
		userRanks.add(new UserRank("VIP4", 10,20,0, 1, 1,1,1 ));
		userRanks.add(new UserRank("VIP5", 10,20,0, 1, 1,1,1 ));
		userRanks.add(new UserRank("VIP6", 10,20,0, 1, 1,1,1 ));
		userRanks.add(new UserRank("VIP7", 10,20,0, 1, 1,1,1 ));
		
		for(UserRank userRank:userRanks){
			context.getUserRankRepository().save(userRank);
		}
	}
	
	private void createCreateCard(){
		List<CreateCard> createCards = new ArrayList<CreateCard>();
		
		createCards.add(new CreateCard("1", "XXX", 1, 1, 1));
		createCards.add(new CreateCard("2", "XXX", 2, 1, 2));
		createCards.add(new CreateCard("3", "XXX", 3, 1, 3));
		createCards.add(new CreateCard("4", "XXX", 4, 1, 2));
		createCards.add(new CreateCard("5", "XXX", 5, 1, 2));
		createCards.add(new CreateCard("6", "XXX", 6, 1, 2));
		createCards.add(new CreateCard("7", "XXX", 1, 1, 2));
		createCards.add(new CreateCard("8", "XXX", 1, 1, 2));
		createCards.add(new CreateCard("9", "XXX", 1, 1, 2));
		createCards.add(new CreateCard("10", "XXX", 1, 1, 2));
		createCards.add(new CreateCard("11", "XXX", 1, 1, 2));
		
		for(CreateCard createCard:createCards){
			context.getCreateCardRepository().save(createCard);
		}
		
	}
	
	private void createCategory(){
		List<Category> categorys = new ArrayList<Category>();
		categorys.add(new Category("test1", 1, 0));
		categorys.add(new Category("test2", 1, 0));
		categorys.add(new Category("test3", 1, 1,1));
		categorys.add(new Category("test4", 1, 1,1));
		categorys.add(new Category("test5", 1, 1,2));
		for(Category category:categorys){
			context.getCategoryRepository().save(category);
		}
		
	}
	
	private void createBusinessMan(){
		List<BusinessMan> businessMans = new ArrayList<BusinessMan>();
		businessMans.add(new BusinessMan("test1",111,"150666788934", "xxx", "xxx.taobao.com", 100001,10,1,1,"备注"));
		businessMans.add(new BusinessMan("test2",111,"150666788934", "xxx", "xxx.taobao.com", 100001,10,1,1,"备注"));
		businessMans.add(new BusinessMan("test3",111,"150666788934", "xxx", "xxx.taobao.com", 100001,10,1,1,"备注"));
		businessMans.add(new BusinessMan("test4",111,"150666788934", "xxx", "xxx.taobao.com", 100001,10,1,1,"备注"));
		businessMans.add(new BusinessMan("test5",111,"150666788934", "xxx", "xxx.taobao.com", 100001,10,1,1,"备注"));
		businessMans.add(new BusinessMan("test6",111,"150666788934", "xxx", "xxx.taobao.com", 100001,10,1,1,"备注"));
		businessMans.add(new BusinessMan("test7",111,"150666788934", "xxx", "xxx.taobao.com", 100001,10,1,1,"备注"));
		businessMans.add(new BusinessMan("test8",111,"150666788934", "xxx", "xxx.taobao.com", 100001,10,1,1,"备注"));
		businessMans.add(new BusinessMan("test9",111,"150666788934", "xxx", "xxx.taobao.com", 100001,10,1,1,"备注"));
		businessMans.add(new BusinessMan("test10",111,"150666788934", "xxx", "xxx.taobao.com", 100001,10,1,1,"备注"));
		businessMans.add(new BusinessMan("test11",111,"150666788934", "xxx", "xxx.taobao.com", 100001,10,1,1,"备注"));
		for(BusinessMan businessMan:businessMans){
			context.getBusinessManRepository().save(businessMan);
		}
		
	}
	
	private void createCard(){
		List<Card> cards = new ArrayList<Card>();
		cards.add(new Card("test1", "test1", 2, "2", 6, 1, 1, 1, 1, 1,1,1,"xx.taobao.com","dfd"));
		cards.add(new Card("test2", "test2", 2, "2", 6, 1, 1, 1, 1, 1,1,1,"xx.taobao.com","dfd"));
		cards.add(new Card("test3", "test3", 2, "2", 6, 1, 1, 1, 1, 1,1,1,"xx.taobao.com","dfd"));
		cards.add(new Card("test4", "test4", 2, "2", 6, 1, 1, 1, 1, 1,1,1,"xx.taobao.com","dfd"));
		
		
		for(Card card:cards){
			context.getCardRepository().save(card);
		}
		
	}
	
	private void createCardRecord(){
		List<CardRecord> cardRecords = new ArrayList<CardRecord>();
		
		cardRecords.add(new CardRecord("test1", "用户1", 1, "移动充值卡", 2));
		cardRecords.add(new CardRecord("test1", "用户1", 1, "移动充值卡", 2));
		cardRecords.add(new CardRecord("test1", "用户1", 1, "移动充值卡", 2));
		cardRecords.add(new CardRecord("test1", "用户1", 1, "移动充值卡", 2));
		cardRecords.add(new CardRecord("test1", "用户1", 1, "移动充值卡", 2));
		cardRecords.add(new CardRecord("test1", "用户1", 1, "移动充值卡", 2));
		cardRecords.add(new CardRecord("test1", "用户1", 1, "移动充值卡", 2));
		cardRecords.add(new CardRecord("test1", "用户1", 1, "移动充值卡", 2));
		cardRecords.add(new CardRecord("test1", "用户1", 1, "移动充值卡", 2));
		cardRecords.add(new CardRecord("test1", "用户1", 1, "移动充值卡", 2));
		cardRecords.add(new CardRecord("test1", "用户1", 1, "移动充值卡", 2));
		
		for(CardRecord cardRecord:cardRecords){
			context.getCardRecordRepository().save(cardRecord);
		}
		
	}
	
	
	private void createPrize(){
		List<Prize> prizes = new ArrayList<Prize>();
		prizes.add(new Prize(1, 1, "奖品1", 20, "xx.taobao.com", 0, 1, 1, "xxx", "test1", 3, "test1"));
		prizes.add(new Prize(1, 1, "奖品2", 30, "xx.taobao.com", 0, 1, 1, "xxx", "test1", 3, "test1"));
		prizes.add(new Prize(1, 1, "奖品3", 40, "xx.taobao.com", 0, 1, 1, "xxx", "test1", 3, "test1"));
		prizes.add(new Prize(1, 1, "奖品4", 50, "xx.taobao.com", 0, 1, 1, "xxx", "test1", 3, "test1"));
		prizes.add(new Prize(1, 1, "奖品5", 60, "xx.taobao.com", 0, 1, 1, "xxx", "test1", 3, "test1"));
		prizes.add(new Prize(1, 1, "奖品6", 70, "xx.taobao.com", 0, 1, 1, "xxx", "test1", 3, "test1"));
		prizes.add(new Prize(1, 1, "奖品7", 80, "xx.taobao.com", 0, 1, 1, "xxx", "test1", 3, "test1"));
		prizes.add(new Prize(1, 1, "奖品8", 90, "xx.taobao.com", 0, 1, 1, "xxx", "test1", 3, "test1"));
		prizes.add(new Prize(1, 1, "奖品9", 100, "xx.taobao.com", 0, 1, 1, "xxx", "test1", 3, "test1"));
		prizes.add(new Prize(1, 1, "奖品10", 110, "xx.taobao.com", 0, 1, 1, "xxx", "test1", 3, "test1"));
		prizes.add(new Prize(1, 1, "奖品11", 120, "xx.taobao.com", 0, 1, 1, "xxx", "test1", 3, "test1"));
		
		
		for(Prize prize:prizes){
			context.getPrizeRepository().save(prize);
		}
		
	}
	
	private void createNote(){
		List<Note> notes = new ArrayList<Note>();
		
		notes.add(new Note("test1", "用户1", 20, 1));
		notes.add(new Note("test2", "用户1", 20, 1));
		notes.add(new Note("test3", "用户1", 20, 1));
		notes.add(new Note("test4", "用户1", 20, 1));
		notes.add(new Note("test5", "用户1", 20, 1));
		notes.add(new Note("test6", "用户1", 20, 1));
		notes.add(new Note("test7", "用户1", 20, 1));
		notes.add(new Note("test8", "用户1", 20, 1));
		notes.add(new Note("test9", "用户1", 20, 1));
		notes.add(new Note("test10", "用户1", 20, 1));
		notes.add(new Note("test11", "用户1", 20, 1));
		
		for(Note note:notes){
			context.getNoteRepository().save(note);
		}
		
	}
	private void createPrizeExplain(){
		PrizeExplain explain = new PrizeExplain("xxx");
			context.getPrizeExplainRepository().save(explain);
		
	}
	
	private void createHoldId(){
		HoldId holdId = new HoldId(10001,"xxx");
			context.getHoldIdRepository().save(holdId);
		
	}
	
	
	private void createSale(){
		SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
		List<Sale> sales = new ArrayList<Sale>();
		
		try {
			sales.add(new Sale("活动1","111", sdf.parse("2014-06-01 10:00:00"),"用户1",1, "XXX.taobao.com"));
			sales.add(new Sale("活动2","111", sdf.parse("2014-06-01 10:00:00"),"用户1",1, "XXX.taobao.com"));
			sales.add(new Sale("活动3","111", sdf.parse("2014-06-01 10:00:00"),"用户1",1, "XXX.taobao.com"));
			sales.add(new Sale("活动4","111", sdf.parse("2014-06-01 10:00:00"),"用户1",1, "XXX.taobao.com"));
			sales.add(new Sale("活动5","111", sdf.parse("2014-06-01 10:00:00"),"用户1",1, "XXX.taobao.com"));
			sales.add(new Sale("活动6","111", sdf.parse("2014-06-01 10:00:00"),"用户1",1, "XXX.taobao.com"));
			sales.add(new Sale("活动7","111", sdf.parse("2014-06-01 10:00:00"),"用户1",1, "XXX.taobao.com"));
			sales.add(new Sale("活动8","111", sdf.parse("2014-06-01 10:00:00"),"用户1",1, "XXX.taobao.com"));
			sales.add(new Sale("活动9","111", sdf.parse("2014-06-01 10:00:00"),"用户1",1, "XXX.taobao.com"));
			sales.add(new Sale("活动10","111", sdf.parse("2014-06-01 10:00:00"),"用户1",1, "XXX.taobao.com"));
			sales.add(new Sale("活动11","111", sdf.parse("2014-06-01 10:00:00"),"用户1",1, "XXX.taobao.com"));
			
		} catch (ParseException e) {
			e.printStackTrace();
		}
		
		for(Sale sale:sales){
			context.getSaleRepository().save(sale);
		}
		
	}
	
	public void createInformation() {

        List<Information> informations = new ArrayList<Information>();
        informations.add(new Information("今日头条1", 100, "今日头条是XX"));
        informations.add(new Information("今日头条2", 100, "今日头条是XX"));
        informations.add(new Information("今日头条3", 100, "今日头条是XX"));
        informations.add(new Information("今日头条4", 100, "今日头条是XX"));
        informations.add(new Information("今日头条5", 100, "今日头条是XX"));
        informations.add(new Information("今日头条6", 100, "今日头条是XX"));
        informations.add(new Information("今日头条7", 100, "今日头条是XX"));
        informations.add(new Information("今日头条8", 100, "今日头条是XX"));
        informations.add(new Information("今日头条9", 100, "今日头条是XX"));
        informations.add(new Information("今日头条10", 100, "今日头条是XX"));
        informations.add(new Information("今日头条11", 100, "今日头条是XX"));
        informations.add(new Information("今日头条12", 100, "今日头条是XX"));
        for(Information information : informations) {
            context.getInformationRepository().save(information);
        }
    }  
	
	public void createHelp() {

        List<Help> helps = new ArrayList<Help>();
        helps.add(new Help("帮助信息1", 100, "今日头条是XX"));
        helps.add(new Help("帮助信息2", 100, "今日头条是XX"));
        helps.add(new Help("帮助信息3", 100, "今日头条是XX"));
        helps.add(new Help("帮助信息4", 100, "今日头条是XX"));
        helps.add(new Help("帮助信息5", 100, "今日头条是XX"));
        helps.add(new Help("帮助信息6", 100, "今日头条是XX"));
        helps.add(new Help("帮助信息7", 100, "今日头条是XX"));
        helps.add(new Help("帮助信息8", 100, "今日头条是XX"));
        helps.add(new Help("帮助信息9", 100, "今日头条是XX"));
        helps.add(new Help("帮助信息10", 100, "今日头条是XX"));
        helps.add(new Help("帮助信息11", 100, "今日头条是XX"));
        helps.add(new Help("帮助信息12", 100, "今日头条是XX"));
        for(Help help : helps) {
            context.getHelpRepository().save(help);
        }
    }  
	
	public void createNotice() {

        List<Notice> notices = new ArrayList<Notice>();
        notices.add(new Notice("公告信息1", 100, "今日头条是XX"));
        notices.add(new Notice("公告信息2", 100, "今日头条是XX"));
        notices.add(new Notice("公告信息3", 100, "今日头条是XX"));
        notices.add(new Notice("公告信息4", 100, "今日头条是XX"));
        notices.add(new Notice("公告信息5", 100, "今日头条是XX"));
        notices.add(new Notice("公告信息6", 100, "今日头条是XX"));
        notices.add(new Notice("公告信息7", 100, "今日头条是XX"));
        notices.add(new Notice("公告信息8", 100, "今日头条是XX"));
        notices.add(new Notice("公告信息9", 100, "今日头条是XX"));
        notices.add(new Notice("公告信息10", 100, "今日头条是XX"));
        notices.add(new Notice("公告信息11", 100, "今日头条是XX"));
        for(Notice notice : notices) {
            context.getNoticeRepository().save(notice);
        }
    } 
	
	
	
	private void createAdminControllers(){
		List<AdminControllerCategory> categories = new ArrayList<AdminControllerCategory>();
		categories.add(new AdminControllerCategory("首页"));
		categories.add(new AdminControllerCategory("游戏管理"));
		categories.add(new AdminControllerCategory("用户管理"));
		categories.add(new AdminControllerCategory("商品管理"));
		categories.add(new AdminControllerCategory("财务管理"));
		categories.add(new AdminControllerCategory("安全管理"));
		categories.add(new AdminControllerCategory("系统管理"));

        for(AdminControllerCategory each : categories){
            context.getAdminControllerCategoryRepository().save(each);
        }
		
		List<AdminControllerDescription> list = new ArrayList<AdminControllerDescription>();
		list.add(new AdminControllerDescription("Home","首页",categories.get(0).getId()));
		list.add(new AdminControllerDescription(categories.get(1).getId(),"Luck28", "幸运28", "edit,save,statistic,share",
				"游戏设置,游戏修改,游戏统计,操作成功", "游戏设置,游戏修改,游戏统计,操作成功"));
		list.add(new AdminControllerDescription(categories.get(1).getId(),"Happy11", "欢乐11", "edit,save,statistic,share",
				"游戏设置,游戏修改,游戏统计,操作成功", "游戏设置,游戏修改,游戏统计,操作成功"));
		list.add(new AdminControllerDescription(categories.get(1).getId(),"Pk10", "PK10", "edit,save,statistic,share",
				"游戏设置,游戏修改,游戏统计,操作成功", "游戏设置,游戏修改,游戏统计,操作成功"));
		list.add(new AdminControllerDescription("User", "用户", categories.get(2).getId()));
		
		AdminControllerDescription userControllerDescription = new AdminControllerDescription(
				categories.get(2).getId(),"User", "用户", 
				"index,list,add,edit,save,delete,update,freeze",
				"用户管理,用户管理,用户添加,用户编辑,用户保存,用户删除,用户更新,用户冻结",
				"用户管理,用户管理,用户添加,用户编辑,用户保存,用户删除,用户更新,冻用户结");
		list.add(userControllerDescription);
		
		AdminControllerDescription userRankControllerDescription = new AdminControllerDescription(
				categories.get(2).getId(),"UserRank", "用户组", 
				"index,list,add,edit,save,delete,update,saveRank",
				"用户组管理,用户组管理,用户组添加,用户组编辑,用户组保存,用户组删除,用户组更新,用户组更新",
				"用户组管理,用户组管理,用户组添加,用户组编辑,用户组保存,用户组删除,用户组更新,用户组更新");
		list.add(userRankControllerDescription);
		
		AdminControllerDescription saleControllerDescription = new AdminControllerDescription(
				categories.get(2).getId(),"Sale", "活动", 
				"index,list,add,edit,save,delete,update",
				"活动管理,活动管理,活动添加,活动编辑,活动保存,活动删除,活动更新",
				"活动管理,活动管理,活动添加,活动编辑,活动保存,活动删除,活动更新");
		list.add(saleControllerDescription);
		
		AdminControllerDescription categoryControllerDescription = new AdminControllerDescription(
				categories.get(3).getId(),"Category", "奖品分类", 
				"index,list,add,edit,save,delete,update,saveCategory,addSon,saveSon",
				"奖品分类管理,奖品分类管理,奖品分类添加,奖品分类编辑,奖品分类保存,奖品分类删除,奖品分类更新,奖品分类更新,添加子分类,保存子分类",
				"奖品分类管理,奖品分类管理,奖品分类添加,奖品分类编辑,奖品分类保存,奖品分类删除,奖品分类更新,奖品分类更新,添加子分类,保存子分类");
		list.add(categoryControllerDescription);
		
		AdminControllerDescription prizeControllerDescription = new AdminControllerDescription(
				categories.get(3).getId(),"Prize", "奖品", 
				"index,list,add,edit,save,delete,update",
				"奖品管理,奖品管理,奖品添加,奖品编辑,奖品保存,奖品删除,奖品更新",
				"奖品管理,奖品管理,奖品添加,奖品编辑,奖品保存,奖品删除,奖品更新");
		list.add(prizeControllerDescription);
		
		AdminControllerDescription prizeExplainControllerDescription = new AdminControllerDescription(
				categories.get(3).getId(),"PrizeExplain", "奖品说明", 
				"index,list,add,edit,save,delete,update",
				"奖品说明管理,奖品说明管理,奖品说明,奖品说明编辑,奖品说明,奖品说明删除,奖品说明更新,",
				"奖品说明管理,奖品说明管理,奖品说明,奖品说明编辑,奖品说明,奖品说明删除,奖品说明更新,");
		list.add(prizeExplainControllerDescription);
		
		AdminControllerDescription noteControllerDescription = new AdminControllerDescription(
				categories.get(3).getId(),"Note", "兑奖记录", 
				"index,list,add,edit,save,delete,update",
				"兑奖记录管理,兑奖记录管理,兑奖记录添加,兑奖记录编辑,兑奖记录保存,兑奖记录删除,兑奖记录更新",
				"兑奖记录管理,兑奖记录管理,兑奖记录添加,兑奖记录编辑,兑奖记录保存,兑奖记录删除,兑奖记录更新");
		list.add(noteControllerDescription);
		
		AdminControllerDescription businessManControllerDescription = new AdminControllerDescription(
				categories.get(4).getId(),"BusinessMan", "商户", 
				"index,list,add,edit,save,delete,update",
				"商户管理,商户管理,商户添加,商户编辑,商户保存,商户删除,商户更新",
				"商户管理,商户管理,商户添加,商户编辑,商户保存,商户删除,商户更新");
		list.add(businessManControllerDescription);
		
		AdminControllerDescription cardControllerDescription = new AdminControllerDescription(
				categories.get(4).getId(),"Card", "充值卡设置", 
				"index,list,add,edit,save,delete,update",
				"充值卡设置,充值卡设置,充值卡设置添加,充值卡设置编辑,充值卡设置保存,充值卡设置删除,充值卡设置更新",
				"充值卡设置,充值卡设置,充值卡设置添加,充值卡设置编辑,充值卡设置保存,充值卡设置删除,充值卡设置更新");
		list.add(cardControllerDescription);
		
		AdminControllerDescription createCardControllerDescription = new AdminControllerDescription(
				categories.get(4).getId(),"CreateCard", "充值卡", 
				"index,list,add,edit,save,delete,update",
				"充值卡管理,充值卡管理,充值卡添加,充值卡编辑,充值卡保存,充值卡删除,充值卡更新",
				"充值卡管理,充值卡管理,充值卡添加,充值卡编辑,充值卡保存,充值卡删除,充值卡更新");
		list.add(createCardControllerDescription);
		
		AdminControllerDescription cardRecordControllerDescription = new AdminControllerDescription(
				categories.get(4).getId(),"CardRecord", "支付记录", 
				"index,list,add,edit,save,delete,update",
				"支付记录管理,支付记录管理,支付记录添加,支付记录编辑,支付记录保存,支付记录删除,支付记录更新",
				"支付记录管理,支付记录管理,支付记录添加,支付记录编辑,支付记录保存,支付记录删除,支付记录更新");
		list.add(cardRecordControllerDescription);
		
		AdminControllerDescription operatorControllerDescription = new AdminControllerDescription(
				categories.get(5).getId(),"Operator", "管理员", 
				"index,list,add,edit,save,delete,update,verifyName",
				"管理员管理,管理员管理,管理员添加,管理员编辑,管理员保存,管理员删除,管理员更新,名字唯一",
				"管理员管理,管理员管理,管理员添加,管理员编辑,管理员保存,管理员删除,管理员更新,名字唯一");
		list.add(operatorControllerDescription);
		
		AdminControllerDescription worklogControllerDescription = new AdminControllerDescription(
				categories.get(5).getId(),"WorkLog", "操作日志", 
				"index,list,add,edit,save,delete,update",
				"操作日志管理,操作日志管理,操作日志添加,操作日志编辑,操作日志保存,操作日志删除,操作日志更新",
				"操作日志管理,操作日志管理,操作日志添加,操作日志编辑,操作日志保存,操作日志删除,操作日志更新");
		list.add(worklogControllerDescription);
		
		AdminControllerDescription informationControllerDescription = new AdminControllerDescription(
				categories.get(6).getId(),"Information", "网站信息", 
				"index,list,add,edit,save,delete,update",
				"网站信息管理,网站信息管理,网站信息添加,网站信息编辑,网站信息保存,网站信息删除,网站信息更新",
				"网站信息管理,网站信息管理,网站信息添加,网站信息编辑,网站信息保存,网站信息删除,网站信息更新");
		list.add(informationControllerDescription);
		
		AdminControllerDescription helpControllerDescription = new AdminControllerDescription(
				categories.get(6).getId(),"Help", "帮助信息", 
				"index,list,add,edit,save,delete,update",
				"帮助信息管理,帮助信息管理,帮助信息添加,帮助信息编辑,帮助信息保存,帮助信息删除,帮助信息更新",
				"帮助信息管理,帮助信息管理,帮助信息添加,帮助信息编辑,帮助信息保存,帮助信息删除,帮助信息更新");
		list.add(helpControllerDescription);
		
		AdminControllerDescription noticeControllerDescription = new AdminControllerDescription(
				categories.get(6).getId(),"Notice", "公告信息", 
				"index,list,add,edit,save,delete,update",
				"公告信息管理,公告信息管理,公告信息添加,公告信息编辑,公告信息保存,公告信息删除,公告信息更新",
				"公告信息管理,公告信息管理,公告信息添加,公告信息编辑,公告信息保存,公告信息删除,公告信息更新");
		list.add(noticeControllerDescription);
		
		AdminControllerDescription holdIdControllerDescription = new AdminControllerDescription(
				categories.get(6).getId(),"HoldId", "保留ID设置", 
				"index,list,add,edit,save,delete,update",
				"保留ID设置管理,保留ID设置管理,保留ID设置添加,保留ID设置编辑,保留ID设置保存,公告信息删除,公告信息更新",
				"保留ID设置管理理,保留ID设置管理,保留ID设置添加,保留ID设置编辑,保留ID设置保存,公告信息删除,公告信息更新");
		list.add(holdIdControllerDescription);
		
		
		
		for(AdminControllerDescription each:list){
            context.getAdminControllerDescriptionRepository().save(each);
        }
		

	}
	public void createOperator() {

        List<Operator> operators = new ArrayList<Operator>();
        operators.add(new Operator("admin","123456","0,1", "0,1", "0,1,2", "0,1", "0,1,2"));
        //operators.add(new Operator("admin1", "123456","超级管理员");
        
        for(Operator operator : operators) {
            context.getOperatorRepository().save(operator);
        }

    }   
    
}
